<?php
#
# author: Phil Spagnolo & Cody Sorgenfrey
# (c)2008 South Hill Calvary Chapel
#



include_once("./root.inc.php");
include("${root}/mysql/database_info.php");
include("${root}/common.php");
include("${root}/mysql/common.php");


$id = $_GET['id'];

$table = "missionaries";
connect_select_test($table);
$query="SELECT * FROM $table WHERE id='$id'";
$result=mysql_query($query) or die (mysql_error());
mysql_close();

$i=0;
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$name = $first." ".$last;
$email=mysql_result($result,$i,"email");
$website=mysql_result($result,$i,"website");
$facebook=mysql_result($result,$i,"facebook");
$blog=mysql_result($result,$i,"blog");
$picture=mysql_result($result,$i,"picture");
$par[0]=mysql_result($result,$i,"bio");
$map=mysql_result($result,$i,"mapEmbed");
$search=mysql_result($result,$i,"searchname");

$num_par=count($par);


$title = $name;
$meta_key=$name.' biography, meet, ministers, missionaries, foreign';
$meta_desc="We are proud to support ".$name." and their work all through out the world.";
print_html_head($title ,$meta_key,$meta_desc);

print_java_head(NULL);
begin_body();
page_title($title);

printf("<div class='rightbar'>\n");
printf("\t%s<br><br>\n",$map);
printf("\t</div>\n");


for ($i=0; $i<$num_par; $i++) {
	if (empty($par[$i])) {
		continue;
	}
	printf("\t<div class=paragraph>\n");
	printf("\t\t%s\n", $par[$i]);
	printf("\t</div><br><br>\n");
}
printf("\t<h4>\n");
printf("\t\tMore...\n");
printf("\t</h4>\n");
printf("\t<div class='paragraph'>\n");
printf("\t\t<ul>\n");

if (!empty($email)) {
	printf("\t\t\t<li><a href='mailto:%s'>%s</a></li>\n", $email, $email);
}
if (!empty($facebook)) {
	printf("\t\t\t<li><a href='%s' target='_blank'><img src='/images/facebook_35x35.png' width='18' height='18'/></a></li>\n", $facebook);
}
if (!empty($website)) {
	printf("\t\t\t<li><a href='%s' target='_blank'>Website</a></li>\n", $website);
}
if (!empty($blog)) {
	printf("\t\t\t<li><a href='%s' target='_blank'>Blog</a></li>\n", $blog);
}
printf("\t\t</ul>\n");
printf("\t</div>\n");

$linkList = array("donations.php", "sermon.php?title=&Book=All&service=All&name=" . $search . "&Type=All&date=All");
$textList = array("Donate to support our missionaries", "Sermons from missionary");

in_page_link(2, false, $linkList, $textList, "");

end_page_title();
end_body();
?>

